package com.guoby.service;

import com.guoby.repository.UserRepository;
import com.guoby.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * Created by pactera on 2018/3/9.
 */
@Service
public class UserService {

    @Autowired
    private UserRepository userRepository;

    @Transactional
    public void inserTwo(){
        User user = new User();
        user.setUsername("曹操3");
        user.setPassword("3221");
        user.setAge(16);
        userRepository.save(user);

        User userB = new User();
        userB.setUsername("曹仁3");
        userB.setPassword("321321321321");
        userB.setAge(6);
        userRepository.save(userB);
    }
}
